<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<ol>
    <li>encodeURI()方法不会对下列字符编码：ASCII字母、数字、~!@#$&*()=:/,;?+'</li>
    <li>encodeURIComponent()方法不会对下列字符编码：ASCII字母、数字、~!*()'</li>
</ol>
<script>
    const basicStr = 'hello world 你好';
    const str = encodeURI(basicStr);
    const str2 = encodeURIComponent(basicStr);
    console.log(str, str2);
    console.log(decodeURI(str), decodeURIComponent(str));
    console.log(decodeURI(str2), decodeURIComponent(str2));
</script>
</body>
</html>